package enums;

import application.GameManager;

public enum Direction {
	
	NORTH,SOUTH,WEST,EAST;
	/**
	 * return true if directions are opposite.
	 * @param first one direction
	 * @param second another direction
	 * @return true if they are opposite, false otherwise
	 */
	public static boolean checkOpposite(Direction first,Direction second){
		boolean ans = (Direction.Opposite(first) == second);
		GameManager.print("opposite: "+ans);
		return ans;
	}
	/**
	 * returns the opposite direction
	 * @param direction the direction to change
	 * @return the opposite direction
	 */
	public static Direction Opposite(Direction direction) {
		Direction ans;
		switch(direction){
			case NORTH : ans = SOUTH; break;
			case SOUTH : ans = NORTH; break;
			case WEST  : ans = EAST;  break;
			case EAST  : ans = WEST;  break;
			default    : ans = null;  break;
		}
		return ans;
	}
}
